/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author SOGOBA
 */
@Entity
@Table(name = "productsstore", catalog = "ecom_db", schema = "")
@NamedQueries({
    @NamedQuery(name = "Productsstore.findAll", query = "SELECT p FROM Productsstore p"),
    @NamedQuery(name = "Productsstore.findByReferenceStore", query = "SELECT p FROM Productsstore p WHERE p.referenceStore = :referenceStore"),
    @NamedQuery(name = "Productsstore.findByName", query = "SELECT p FROM Productsstore p WHERE p.name = :name"),
    @NamedQuery(name = "Productsstore.findByAdress", query = "SELECT p FROM Productsstore p WHERE p.adress = :adress")})
public class Productsstore implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "reference_store", nullable = false)
    private Integer referenceStore;
    @Column(name = "name", length = 50)
    private String name;
    @Basic(optional = false)
    @Column(name = "Adress", nullable = false, length = 50)
    private String adress;
    @JoinColumn(name = "id_account_fk", referencedColumnName = "id_account")
    @ManyToOne
    private Accounts accounts;
    @OneToMany(mappedBy = "productsstore")
    private List<Products> productsList;

    public Productsstore() {
    }

    public Productsstore(Integer referenceStore) {
        this.referenceStore = referenceStore;
    }

    public Productsstore(Integer referenceStore, String adress) {
        this.referenceStore = referenceStore;
        this.adress = adress;
    }

    public Integer getReferenceStore() {
        return referenceStore;
    }

    public void setReferenceStore(Integer referenceStore) {
        this.referenceStore = referenceStore;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAdress() {
        return adress;
    }

    public void setAdress(String adress) {
        this.adress = adress;
    }

    public Accounts getAccounts() {
        return accounts;
    }

    public void setAccounts(Accounts accounts) {
        this.accounts = accounts;
    }

    public List<Products> getProductsList() {
        return productsList;
    }

    public void setProductsList(List<Products> productsList) {
        this.productsList = productsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (referenceStore != null ? referenceStore.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Productsstore)) {
            return false;
        }
        Productsstore other = (Productsstore) object;
        if ((this.referenceStore == null && other.referenceStore != null) || (this.referenceStore != null && !this.referenceStore.equals(other.referenceStore))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Productsstore[referenceStore=" + referenceStore + "]";
    }

}
